<template>
  <div class="indexContainer">
    <div class="indexDirect">
      <el-row :gutter="10">
        <el-col :xs="24" :sm="24" :md="18" :lg="5" :xl="5">
          <p class="dirctTitle">订阅推荐</p>
        </el-col>
        <el-col :xs="24" :sm="24" :md="18" :lg="19" :xl="19">
          <div class="subscribe">
            <el-col :xs="24" :sm="24" :md="18" :lg="6" :xl="6" v-for="item in subscribeData" :key="item.id">
              <div class="dirctItem">
                <span class="circle"></span>
                <span class="circleText" @click="handleProDetail(item.id)">{{item.title}}</span>
              </div>
            </el-col>
          </div>
        </el-col>
      </el-row>

    </div>

  </div>
</template>
<script>
import { getProductList, proTop } from "@/request/api/index"
export default {
  components: {

  },

  data() {
    return {
      subscribeData: [],
      params: {
        isSubscribe: '1',//是否订阅1是2否
        current: 1,
        pageSize: 8
      },
      userId:''
    };
  },
  created() {
    this.getList()
    if (window.sessionStorage.getItem("userInfo") !== null) {
      let userInfo = JSON.parse(window.sessionStorage.getItem("userInfo"));
      this.userId = userInfo.id
    }
  },
  mounted() {

  },
  computed: {

  },
  methods: {
    // 获取订阅产品
    getList() {
      getProductList(this.params).then(res => {
        if (res.data.code == 1) {
          this.subscribeData = res.data.data.totalList
        }
      })
    },
    // 产品详情
    handleProDetail(id) {
      this.$router.push({
        name: "ApplicationProductsDetail",
        query: {
          id,
          userId: this.userId
        }
      });
    }
  },
};
</script>
<style lang="less" scoped>
@import "./directOperated.less";
@import "../common.less";
</style>
